package com.ln.lnzw.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.ln.lnzw.R;
import com.ln.lnzw.bean.NewImplementationSubjectBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wwj on 2017/6/23.
 */
public class MyPopAdapter extends BaseAdapter {
    private List<NewImplementationSubjectBean.ResultBean> list= new ArrayList<>();
    private Context mContext;
    public MyPopAdapter(Context mContext, List<NewImplementationSubjectBean.ResultBean> list){
        this.mContext=mContext;
        this.list=list;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder1 viewholder1 = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.pop_menuitem, null);
            viewholder1 = new ViewHolder1();
            viewholder1.menuitem = (TextView) convertView.findViewById(R.id.menuitem);
            convertView.setTag(viewholder1);
        } else {
            viewholder1 = (ViewHolder1) convertView.getTag();
        }
//        if (position==0){
            viewholder1.menuitem.setText(list.get(position).getGroupName());
//        }else{
//            viewholder1.menuitem.setText(list.get(position).getDeviceName()+"("+list.get(position).getCode()+")"+"-"+list.get(position).getArea());
//        }
        return convertView;
    }
        class ViewHolder1 {
            private TextView menuitem;

        }
}
